<?php
if(cmd('php')){
	if(!empty($msg_args[1])){ // give them the information from the online manual at php.net
		$PHP_URL='http://www.php.net/manual/en/function.'.$msg_args[1].'.php';
		$PHP_Page=file_get_contents($PHP_URL);
		$PHP_Page=str_replace(Array("\r","\n"),'',$PHP_Page);
		$PHP_Page=str_replace(Array('<b>','</b>'),chr(2),$PHP_Page);
		$PHP_Page=str_replace('&nbsp;',' ',$PHP_Page);
		$PHP_Page=str_replace('&amp;','&',$PHP_Page);
		
		$PHP_Response="The command '$param' was not found. If you think it should be there, try searching http://php.net/";
		if(!stristr($PHP_Page,'is not in the online manual')){ // the function is in the online manual at php.net
			if(stristr($PHP_Page,'<div class="methodsynopsis dc-description">')){
				$PHP_splitP1=explode('<div class="methodsynopsis dc-description">',$PHP_Page);
				$PHP_P1=$PHP_splitP1[1];
				$PHP_splitP2=explode('</div>',$PHP_P1);
				$PHP_ResponseP1=strip_tags(substr($PHP_splitP2[0],3));
				if($useColors!=false){
					$PHP_Response='Syntax: '.chr(3)."2$PHP_ResponseP1".chr(3).' Please view http://php.net/'.urlencode($msg_args[1]).' for more details.';
				} else {
					$PHP_Response="Syntax: $PHP_ResponseP1 Please view http://php.net/".urlencode($msg_args[1]).' for more details.';
				}
			} else {
				if($useColors){
					$PHP_Response='Information on "'.chr(3)."2$msg_args[1]".chr(3).'" can be found at http://php.net/'.urlencode($msg_args[1]);
				} else {
					$PHP_Response="Information on \"$msg_args[1]\" can be found at http://php.net/".urlencode($msg_args[1]);
				}
			}
		}
	}
	if(empty($PHP_Response)){ // give them the default php.net url
		$PHP_Response='The PHP homepage is at http://php.net';
	}
	while(stristr($PHP_Response,"  ")){
		$PHP_Response=str_replace("  "," ",$PHP_Response);
	}
	reply($PHP_Response);
}
?>